package com.yzyz.utils.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

import org.springframework.jdbc.core.RowMapper;

import com.yzyz.bean.region.RegionBean;

public class RegionRowMapper implements RowMapper {

	@Override
	public Object mapRow(ResultSet rs, int arg1) throws SQLException {
		RegionBean region = new RegionBean();
		region.setAvailable(rs.getBoolean("available"));
		region.setId(rs.getInt("id"));
		region.setName(rs.getString("name"));
		region.setDate(new Date(rs.getTimestamp("date").getTime()));
		region.setDescription(rs.getString("description"));
		region.setLevel(rs.getInt("level"));
		return region;
	}

}
